﻿<%@ Page Title="" Language="C#" MasterPageFile="~/TsSite.Master" AutoEventWireup="true" CodeBehind="EditCustomerData.aspx.cs" Inherits="TireService.Web.View.CustomerView.EditCustomerData" %>
<%@ Register Assembly="DevExpress.Web.v11.1, Version=11.1.12.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" Namespace="DevExpress.Web.ASPxSplitter" TagPrefix="dx" %>
<%@ Register Assembly="DevExpress.Web.v11.1, Version=11.1.12.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" Namespace="DevExpress.Web.ASPxNavBar" TagPrefix="dx" %>
<%@ Register Assembly="DevExpress.Web.v11.1, Version=11.1.12.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" Namespace="DevExpress.Web.ASPxLoadingPanel" TagPrefix="dx" %>

<%@ Register src="../../UserControls/Customer/ucEditCustomer.ascx" tagname="ucEditCustomer" tagprefix="uc1" %>
<%@ Register src="../../UserControls/Customer/upEditCustomerSubscription.ascx" tagname="upEditCustomerSubscription" tagprefix="uc2" %>
<%@ Register src="../../UserControls/Customer/ucEditCar.ascx" tagname="ucEditCar" tagprefix="uc3" %>
<%@ Register src="../../UserControls/Customer/ucEditCustomerTireSet.ascx" tagname="ucEditCustomerTireSet" tagprefix="uc4" %>
<%@ Register src="../../UserControls/Customer/ucEditCustomerService.ascx" tagname="ucEditCustomerService" tagprefix="uc5" %>
<%@ Register src="../../UserControls/Customer/ucEditCustomerInvoice.ascx" tagname="ucEditCustomerInvoice" tagprefix="uc6" %>
<%@ Register src="../../UserControls/Customer/ucEditCustomerLog.ascx" tagname="ucEditCustomerLog" tagprefix="uc7" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    
    <dx:ASPxLoadingPanel ID="LoadingPanel" Text="Vent venligst..." ClientInstanceName="LoadingPanel" runat="server" Modal="True">
    </dx:ASPxLoadingPanel>

    <!-- Javascript for handling menu clicks  -->
    <script language="javascript" type="text/javascript">

        var EditCustomerId = 0; 
        

        function SetEditCustomerId(id) {
            EditCustomerId = id;
        }

        function EditCustomerActionClicked(e) {
            LoadMenuAction(e.item.name);           
        }

        function LoadMenuAction(selectedmenu) {

            LoadingPanel.Show();
            
            // Set menu button as selected
            nbEditCustomer.SetSelectedItem(nbEditCustomer.GetGroupByName(selectedmenu));

            // Edit customer data selected
            if (selectedmenu == 'EditCustomerData') {

                // Show edit customer data usercontrol
                LoadEditCustomerUserControl(EditCustomerId);

                // Hide other usercontrols
                HideEditCustomerSubscriptionUserControl();
                HideEditCustomerCarUserControl();
                HideEditCustomerTireSetUserControl();
                HideEditCustomerServiceUserControl();
                HideEditCustomerInvoiceUserControl();
                HideEditCustomerLogUserControl();
            }

            // Edit subscriptions selected
            if (selectedmenu == 'EditSubscriptions') {

                // Show edit subscription usercontrol
                LoadEditCustomerSubscriptionUserControl(EditCustomerId);

                // Hide other usercontrols
                HideEditCustomerUserControl();
                HideEditCustomerCarUserControl();
                HideEditCustomerTireSetUserControl();
                HideEditCustomerServiceUserControl();
                HideEditCustomerInvoiceUserControl();
                HideEditCustomerLogUserControl();
            }

            // Edit cars selected
            if (selectedmenu == 'EditCars') {

                // Show edit cars usercontrol
                LoadEditCustomerCarUserControl(EditCustomerId);

                // Hide other usercontrols
                HideEditCustomerUserControl();
                HideEditCustomerSubscriptionUserControl();
                HideEditCustomerTireSetUserControl();
                HideEditCustomerServiceUserControl();
                HideEditCustomerInvoiceUserControl();
                HideEditCustomerLogUserControl();
            }

            // Edit tiresets selected
            if (selectedmenu == 'EditTireSets') {

                // Show edit tiresets usercontrol
                LoadEditCustomerTireSetUserControl(EditCustomerId);

                // Hide other usercontrols
                HideEditCustomerUserControl();
                HideEditCustomerSubscriptionUserControl();
                HideEditCustomerCarUserControl();
                HideEditCustomerServiceUserControl();
                HideEditCustomerInvoiceUserControl();
                HideEditCustomerLogUserControl();
            }

            // Edit services selected
            if (selectedmenu == 'EditServices') {

                // Show edit service usercontrol
                LoadEditCustomerServiceUserControl(EditCustomerId);

                // Hide other usercontrols
                HideEditCustomerUserControl();
                HideEditCustomerSubscriptionUserControl();
                HideEditCustomerCarUserControl();
                HideEditCustomerTireSetUserControl();
                HideEditCustomerInvoiceUserControl();
                HideEditCustomerLogUserControl();
            }

            // Edit invoice selected
            if (selectedmenu == 'EditInvoices') {

                // Show edit invoice usercontrol
                LoadEditCustomerInvoiceUserControl(EditCustomerId);

                // Hide other usercontrols
                HideEditCustomerUserControl();
                HideEditCustomerSubscriptionUserControl();
                HideEditCustomerCarUserControl();
                HideEditCustomerTireSetUserControl();
                HideEditCustomerServiceUserControl();
                HideEditCustomerLogUserControl();
            }

            // Edit log selected
            if (selectedmenu == 'EditLog') {

                // Show edit log usercontrol
                LoadEditCustomerLogUserControl(EditCustomerId);

                // Hide other usercontrols
                HideEditCustomerUserControl();
                HideEditCustomerSubscriptionUserControl();
                HideEditCustomerCarUserControl();
                HideEditCustomerTireSetUserControl();
                HideEditCustomerServiceUserControl();
                HideEditCustomerInvoiceUserControl();
            }
        }

    </script>



    <table>
        <tr>
            <td valign="top" style="width:150px">
                <dx:ASPxNavBar ID="nbEditCustomer" ClientInstanceName="nbEditCustomer" runat="server">
                    <Paddings PaddingBottom="0px" PaddingLeft="0px" PaddingRight="0px" 
                        PaddingTop="0px" />
                    <GroupHeaderStyle HorizontalAlign="Left" />
                    <ItemStyle HorizontalAlign="Left" />
                    <ClientSideEvents ItemClick="function(s, e) { EditCustomerActionClicked(e) }" />
                    <Groups>
                        <dx:NavBarGroup ItemImagePosition="Top" Text="Rediger kunde">
                            <ContentStyle>
                                <Paddings PaddingBottom="1px" PaddingTop="1px" />
                            </ContentStyle>
                            <ItemStyle HorizontalAlign="Center" />
                            <Items>
                                <dx:NavBarItem Text="Kontaktoplysninger" Name="EditCustomerData">
                                    <Image Height="24px" Url="~/Images/Small/businessmen.png" Width="24px" />
                                </dx:NavBarItem>
                                <dx:NavBarItem Text="Abonnementer" Name="EditSubscriptions" >
                                    <Image Height="24px" Url="~/Images/Small/date-time.png" Width="24px" />
                                </dx:NavBarItem>
                                <dx:NavBarItem Text="Biler" Name="EditCars">
                                    <Image Height="24px" Url="~/Images/Small/car_sedan_blue.png" Width="24px" />
                                </dx:NavBarItem>
                                <dx:NavBarItem Text="Hjulsæt" Name="EditTireSets" >
                                    <Image Height="24px" Url="~/Images/Small/wheel.png" Width="24px" />
                                </dx:NavBarItem>
                                <dx:NavBarItem Text="Udkørsler og opgaver" Name="EditServices">
                                    <Image Height="24px" Url="~/Images/Small/gears.png" Width="24px" />
                                </dx:NavBarItem>
                                <dx:NavBarItem Text="Faktura" Name="EditInvoices">
                                    <Image Height="24px" Url="~/Images/Small/cashier.png" Width="24px" />
                                </dx:NavBarItem>
                                <dx:NavBarItem Text="Historik" Name="EditLog">
                                    <Image Height="24px" Url="~/Images/Small/history.png" Width="24px" />
                                </dx:NavBarItem>
                            </Items>
                        </dx:NavBarGroup>
                    </Groups>
                </dx:ASPxNavBar>
            </td>
            <td valign="top">
                <!-- Placement of edit customer data usercontrols -->
                <uc1:ucEditCustomer ID="ucEditCustomer" runat="server" />
                <uc2:upEditCustomerSubscription ID="upEditCustomerSubscription" runat="server" />
                <uc3:ucEditCar ID="ucEditCar" runat="server" />
                <uc4:ucEditCustomerTireSet ID="ucEditCustomerTireSet" runat="server" />
                <uc5:ucEditCustomerService ID="ucEditCustomerService" runat="server" />
                <uc6:ucEditCustomerInvoice ID="ucEditCustomerInvoice" runat="server" />
                <uc7:ucEditCustomerLog ID="ucEditCustomerLog" runat="server" />
            </td>
        </tr>
    </table>

</asp:Content>
